package com.xmim.fulcrum.session;

import com.xmim.core.exception.ContainerException;
import com.xmim.core.session.SessionListener;
import com.xmim.core.session.SessionManager;
import com.xmim.fulcrum.node.FulcrumNode;
import com.xmim.fulcrum.node.FulcrumNodeListener;
import com.xmim.fulcrum.node.FulcrumServiceNode;

import java.util.Collection;

public interface FulcrumSessionManager extends FulcrumNodeListener, SessionManager<FulcrumSession> {


    @Override
    SessionManager<FulcrumSession> addSessionListener(SessionListener<FulcrumSession> sessionListener);

    @Override
    SessionManager<FulcrumSession> addSession(String sessionId, FulcrumSession session);

    FulcrumSessionManager addSession(String path, FulcrumNode data) throws ContainerException;

    @Override
    FulcrumSession getSession(String sessionId);


    void destroySession(FulcrumServiceNode remoteNode);

    /**
     * 向其他支点服务器发送数据
     *
     * @param obj
     */
    void writeAllClient(Object obj);


    /**
     * 获取所有发送器
     *
     * @return
     */
    Collection<FulcrumSession> senders();

    /**
     * 设置本地节点
     *
     * @param localNode
     */
    void setLocalNode(FulcrumServiceNode localNode);
}
